<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function fn(x) {
        var a = x.split("-");

        var c = "";

        for (var i = 0; i < a.length; i++) {
          if (i>=0) {
            c += a[i].charAt(0).toUpperCase() + a[i].slice(1).toLowerCase();
          }
        }
        return c;
      }

      console.log(fn("background-color-jay-chou"));
    </script>
  </body>
</html>
